// src/router/index.js
import { createRouter, createWebHistory } from 'vue-router'
import LoginPageManager from '@/views/LoginPageManager.vue'
import LoginPageUser from '@/views/LoginPageUser.vue'
import HomePage from '@/views/HomePage.vue'
import SearchResult from '@/views/SearchResult.vue'
import ShoppingCart from '@/views/ShoppingCart.vue'
import ManagerPage from '@/views/ManagerPage.vue'
import ManagerPageUserList from '@/views/ManagerPageUserList.vue'
import ManagerPageAdminList from '@/views/ManagerPageAdminList.vue'
import ManagerPageProductList from '@/views/ManagerPageProductList.vue'
import PersonalCenter from '@/views/PersonalCenter.vue'
import ViewRecording from '@/views/ViewRecording.vue'
import PersonalInfo from '@/views/PersonalInfo.vue'
import Registration from '@/views/Registration.vue'
import ItemInfo from '@/views/ItemInfo.vue'
import ChangePassword from '@/views/ChangePassword.vue'
import RankingPage from '@/views/RankingPage.vue'
import PreferenceSettings from '@/views/PreferenceSettings.vue'

const routes = [
  { path: '/admin-login', component: LoginPageManager },
  { path: '/user-login', component: LoginPageUser },
  { path: '/home', component: HomePage },
  { path: '/search', component: SearchResult },
  { path: '/shopping-cart', component: ShoppingCart },
  { path: '/manager', component: ManagerPage },
  { path: '/userlist', component: ManagerPageUserList },
  { path: '/adminlist', component: ManagerPageAdminList },
  { path: '/productlist', component: ManagerPageProductList },
  { path: '/personalcenter', component: PersonalCenter },
  { path: '/viewrecording', component: ViewRecording },
  { path: '/personalinfo', component: PersonalInfo },
  { path: '/registration', component: Registration },
  { path: '/iteminfo/:id', component: ItemInfo },
  { path: '/change-password', component: ChangePassword },
  { path: '/rankings', component: RankingPage },
  { path: '/preference-settings', component: PreferenceSettings },
  { path: '/', redirect: '/user-login' }
]

const router = createRouter({
  history: createWebHistory(),
  routes
})

export default router